import { IForm } from "@/components/Form/Com/types.ts";
import { dayjs } from "element-plus";

export const searchFormConfig: IForm = {
  formItems: [
    {
      field: "address",
      type: "input",
      label: "地址",
      placeholder: "请输入地址",
    },
    {
      field: "project",
      type: "select",
      label: "项目",
      placeholder: "请选择项目",
      options: [
        {
          title: "客户数据平台",
          value: "cdp",
        },
        {
          title: "谋略平台",
          value: "molo",
        },
        {
          title: "上海科技馆",
          value: "wikeH5",
        },
      ],
    },
    {
      field: "createAt",
      type: "datepicker",
      label: "创建时间",
      otherOptions: {
        startPlaceholder: "开始时间",
        endPlaceholder: "结束时间",
        type: "daterange",
      },
    },
  ],
};

export const contentTableConfig: any = {
  title: "",
  propList: [
    {
      prop: "address",
      label: "地址",
      minWidth: "80",
    },
    {
      prop: "project",
      label: "项目",
      minWidth: "80",
    },
    {
      prop: "createAt",
      label: "创建时间",
      minWidth: "120",
      slotName: "createAt",
    },
    {
      prop: "status",
      label: "状态",
      minWidth: "80",
      slotName: "status",
    },
    {
      prop: "content",
      label: "内容",
      minWidth: "140",
    },
    {
      label: "操作",
      minWidth: "100",
      slotName: "handler",
    },
  ],
  showIndexColumn: true,
  showSelectColumn: false,
};

export const submitFormConfig: IForm = {
  formItems: [
    {
      field: "address",
      type: "select",
      label: "地址",
      placeholder: "请选择地址",
      default: "HTSD",
      options: [
        {
          title: "京东总部",
          value: "JDZB",
        },
        {
          title: "汇通时代广场",
          value: "HTSD",
        },
        {
          title: "其他",
          value: "0",
        },
      ],
      rules: [{ required: true, message: "请选择地址", trigger: "change" }],
    },
    // {
    //   field: "address",
    //   type: "input",
    //   label: "地址",
    //   placeholder: "请输入地址",
    //   default:'',
    //   rules:[{ required: true, message: '请输入地址', trigger: 'blur' }]
    // },
    {
      field: "project",
      type: "select",
      label: "项目",
      placeholder: "请选择项目",
      default: "cdp",
      options: [
        {
          title: "客户数据平台",
          value: "cdp",
        },
        {
          title: "谋略平台",
          value: "molo",
        },
        {
          title: "上海科技馆",
          value: "wikeH5",
        },
        {
          title: "其他",
          value: "0",
        },
      ],
      rules: [{ required: true, message: "请选择项目", trigger: "change" }],
    },
    {
      field: "createAt",
      type: "date",
      label: "创建时间",
      default: dayjs().format("YYYY-MM-DD"),
      otherOptions: {
        placeholder: "请选择时间",
        format: "YYYY-MM-DD",
        "value-format": "YYYY-MM-DD",
      },
      rules: [{ required: true, message: "请选择时间", trigger: "change" }],
    },
    {
      field: "status",
      type: "select",
      label: "状态",
      placeholder: "请选择状态",
      default: "0",
      options: [
        {
          title: "未开始",
          value: "0",
        },
        {
          title: "已完成",
          value: "1",
        },
        {
          title: "未完成",
          value: "2",
        },
      ],
    },
    {
      field: "content",
      type: "input",
      label: "内容",
      placeholder: "请输入内容",
      default: "",
      otherOptions: {
        type: "textarea",
        rows: 4,
      },
      rules: [{ required: true, message: "请输入内容", trigger: "blur" }],
    },
  ],
};
